package cn.lxh.controller.app;

import cn.dev33.satoken.stp.StpUtil;
import cn.lxh.result.JSONResult;
import cn.lxh.template.GeTuiTemplate;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lxh Create Time: 2024/1/16 13:28
 */
@Tag(name = "小程序个推",description = "小程序个推")
@RestController
@RequestMapping("/app/getui")
public class AppGeTuiController {
    @Autowired
    public GeTuiTemplate geTuiTemplate;

    @Operation( summary= "给cid绑定别名",description = "给cid绑定别名")
    @Parameter(name = "cid",description = "客户端id",required = true)
    @PostMapping("/bindingAlias/{cid}")
    public JSONResult mpLogin(@PathVariable String cid){
        // 绑定别名
        Boolean bindingAlias = geTuiTemplate.bindingAlias(cid, StpUtil.getLoginIdAsString());
        return JSONResult.success(bindingAlias);
    }

}
